
#####seaborn绘制散点图——————————————————————————————————————————
#
# import seaborn as sns
# import pandas
# import matplotlib.pyplot as plt
#
# # load csv
# data = pandas.read_csv("sample_data.csv")
#
# # plotting
# sns.scatterplot(x=data['Age'],y= data['Income'])
# plt.show()





#####seaborn绘制折线图——————————————————————————————————————————————————————————————

# import seaborn as sns
# import pandas
# import matplotlib.pyplot as plt
#
# # loading csv
# data = pandas.read_csv("sample_data.csv")
#
# # plotting lineplot
# sns.lineplot(x=data['Age'],y= data['Income'])
# plt.show()





###seaborn绘制直方图——————————————————————————————————————————————————
# import seaborn as sns
# import pandas
# import matplotlib.pyplot as plt
# # read top 5 column
# data = pandas.read_csv("sample_data.csv").head()
#
# sns.histplot(data['Age'])
# plt.show()





###seaborn绘制箱线图————————————————————————————————————————————————————————————
# ###（1）双变量
# import pandas as pd
# import matplotlib.pyplot as plt
# import seaborn as sns
# import numpy as np
#
# # 设置样式（使用英文，避免中文问题）
# plt.style.use('default')
# sns.set_palette("Set2")
#
# # 创建示例数据
# np.random.seed(42)
# data = {
#     'Age': np.concatenate([
#         np.random.normal(25, 3, 50),
#         np.random.normal(40, 5, 50),
#         np.random.normal(60, 7, 50)
#     ]),
#     'Income': np.concatenate([
#         np.random.normal(30000, 5000, 50),
#         np.random.normal(60000, 10000, 50),
#         np.random.normal(90000, 15000, 50)
#     ]),
#     'Group': ['Young'] * 50 + ['Middle'] * 50 + ['Senior'] * 50,
#     'Score': np.concatenate([
#         np.random.normal(75, 10, 50),
#         np.random.normal(85, 8, 50),
#         np.random.normal(65, 12, 50)
#     ]),
#     'Hours_Studied': np.random.normal(20, 5, 150),
#     'Department': np.random.choice(['Math', 'Science', 'Arts'], 150)
# }
#
# df = pd.DataFrame(data)
#
# # 添加一些异常值
# df.loc[10, 'Income'] = 150000
# df.loc[80, 'Score'] = 30
# df.loc[120, 'Age'] = 18
#
# # 图表1: 单变量箱线图比较
# plt.figure(figsize=(12, 6))
# plt.subplot(1, 2, 1)
# df.boxplot(column=['Age', 'Income', 'Score', 'Hours_Studied'])
# plt.title('A. Numerical Variables Distribution', fontsize=14, fontweight='bold')
# plt.xticks(rotation=45)
# plt.ylabel('Values')
#
# plt.subplot(1, 2, 2)
# sns.boxplot(data=df[['Age', 'Income', 'Score', 'Hours_Studied']])
# plt.title('B. Multiple Variables Boxplot', fontsize=14, fontweight='bold')
# plt.xticks(rotation=45)
# plt.tight_layout()
# plt.show()
#
# # 图表2: 按组别的收入分布
# plt.figure(figsize=(10, 6))
# sns.boxplot(x='Group', y='Income', data=df,
#             order=['Young', 'Middle', 'Senior'])
# plt.title('Income Distribution by Age Group', fontsize=16, fontweight='bold')
# plt.xlabel('Age Group', fontsize=12)
# plt.ylabel('Income ($)', fontsize=12)
# plt.grid(True, alpha=0.3, linestyle='--')
# plt.tight_layout()
# plt.show()
#
# # 图表3: 按部门和组别的分数分布
# plt.figure(figsize=(12, 6))
# sns.boxplot(x='Department', y='Score', hue='Group', data=df,
#             hue_order=['Young', 'Middle', 'Senior'])
# plt.title('Score Distribution by Department and Age Group', fontsize=16, fontweight='bold')
# plt.xlabel('Department', fontsize=12)
# plt.ylabel('Score', fontsize=12)
# plt.legend(title='Age Group', bbox_to_anchor=(1.05, 1), loc='upper left')
# plt.grid(True, alpha=0.3, linestyle='--')
# plt.tight_layout()
# plt.show()


###对比KDE plot——————————————————————






